import http from './request'
import http1 from './requestOne'
import http2 from './requestTwo'
import http4 from './request4'
import http3 from './requestThree'

import bus from '@/until/bus'
import bus2 from '@/until/bus2'

let url=''
bus.$on('sendVal', data=>{
    url=data
    console.log(url);
})
let cid=''
bus.$on('sendCid', data=>{
    cid=data
    console.log('cid',cid);
})

let rid='';
bus2.$on('sendRid', data=>{
    rid=data
    console.log('123',rid);
    
})

export const newList = (data={})=> {
    return http.get('/stories/latest',{params: data})
}
export const oldList = (data={})=> {
    return http.get(`${url}`,{params: data})
}
export const detail = (data={})=> {
    return http.get(`/story/${rid}`,{params: data})
}
export const answer = (data={})=> {
    return http2.get(`/story/${rid}`,{params: data})
}
export const comment = (data={})=> {
    return http.get(`/story/${cid}/short-comments`,{params: data})
}
export const hot = (data={})=> {
    return http1.get(``,{params: data})
}
export const search = (data={})=> {
    return http4.get(``,{params: data})
}
// export const story = (data={})=> {
//     return http3.get(``,{params: data})
// }